package org.bmind.datasword.config.dto;

import java.util.Date;

import javax.xml.bind.annotation.XmlElement;

import org.bmind.datasword.utils.EqualsUtil;
import org.bmind.datasword.utils.HashCodeUtil;
import org.bmind.datasword.utils.StorageUtilities;
//@XmlRootElement
public class DDataset extends DObjIdentity {
	static { StorageUtilities.addREngineType(DDataset.class); }
	private int fHashCode ;
	private int dimKb = 0;
	private int numRow =0;
	private int numCol = 0;
	
	private String note = null;
	private String description = null;
	private String status = null;
	private String filePath = null;
	private String uploadUserID = null;

	private Date  uploadDate = null;
 	private Date referenceDate = null;
	
	
	

	public DDataset() {	super();}

	
	/**
	 * @return the dimKb
	 */
	public int getDimKb() {return dimKb;}

	/**
	 * @param dimKb the dimKb to set
	 */
	@XmlElement
	public void setDimKb(int dimKb) {this.dimKb = dimKb;}

	/**
	 * @return the numRow
	 */
	public int getNumRow() {return numRow;}

	/**
	 * @param numRow the numRow to set
	 */
	@XmlElement
	public void setNumRow(int numRow) {	this.numRow = numRow;}

	/**
	 * @return the numCol
	 */
	public int getNumCol() {return numCol;}

	/**
	 * @param numCol the numCol to set
	 */
	@XmlElement
	public void setNumCol(int numCol) {this.numCol = numCol;}

	/**
	 * @return the note
	 */
	public String getNote() {return note;}

	/**
	 * @param note the note to set
	 */
	@XmlElement
	public void setNote(String note) {this.note = note;}

	/**
	 * @return the description
	 */
	public String getDescription() {return description;}

	/**
	 * @param description the description to set
	 */
	@XmlElement
	public void setDescription(String description) {this.description = description;}

	/**
	 * @return the status
	 */
	public String getStatus() {return status;}

	/**
	 * @param status the status to set
	 */
	@XmlElement
	public void setStatus(String status) {this.status = status;}

	/**
	 * @return the uploadUserID
	 */
	public String getUploadUserID() {return uploadUserID;}

	/**
	 * @param uploadUserID the uploadUserID to set
	 */
	@XmlElement
	public void setUploadUserID(String uploadUserID) {this.uploadUserID = uploadUserID;}

	/**
	 * @return the uploadDate
	 */
	public Date getUploadDate() {return uploadDate;}

	/**
	 * @param uploadDate the uploadDate to set
	 */
	@XmlElement
	public void setUploadDate(Date uploadDate) {this.uploadDate = uploadDate;}

	/**
	 * @return the referenceDate
	 */
	public Date getReferenceDate() {return referenceDate;}

	/**
	 * @param referenceDate the referenceDate to set
	 */
	@XmlElement
	public void setReferenceDate(Date referenceDate) {this.referenceDate = referenceDate;}

	/**
	 * @return the filePath
	 */
	public String getFilePath() {return filePath;}

	/**
	 * @param filePath the filePath to set
	 */
	@XmlElement
	public void setFilePath(String filePath) {this.filePath = filePath;}
	
	
	/* (non-Javadoc)
     * @see org.bmind.datasword.config.dto.DObjCommon#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object obj) {
        if ( this == obj ) return true;
 	    if ( !(obj instanceof DData) ) return false;
 	   
 	    DDataset dDts = (DDataset)obj;
     	
     	return	EqualsUtil.areEqual(this.getName(), dDts.getName()) &&
     			EqualsUtil.areEqual(this.description, dDts.description) &&
     			EqualsUtil.areEqual(this.dimKb, dDts.dimKb) &&
     			EqualsUtil.areEqual(this.filePath, dDts.filePath) &&
     			EqualsUtil.areEqual(this.note, dDts.note) &&
     			EqualsUtil.areEqual(this.numCol, dDts.numCol) &&
     			EqualsUtil.areEqual(this.numRow, dDts.numRow) &&
     			EqualsUtil.areEqual(this.referenceDate, dDts.referenceDate) &&
     			EqualsUtil.areEqual(this.status, dDts.status) &&
     			EqualsUtil.areEqual(this.uploadDate, dDts.uploadDate) &&
     			EqualsUtil.areEqual(this.uploadUserID, dDts.uploadUserID) &&
     			EqualsUtil.areEqual(this.getRoles(), dDts.getRoles()) &&
     			EqualsUtil.areEqual(this.getAreas(), dDts.getAreas()) &&
     			EqualsUtil.areEqual(this.getID(), dDts.getID()) &&
     			EqualsUtil.areEqual(this.getNextId(), dDts.getNextId()) &&
     			EqualsUtil.areEqual(this.getPreviusId(), dDts.getPreviusId()) && 
     			EqualsUtil.areEqual(this.getNote(), dDts.getNote()) && 
     			EqualsUtil.areEqual(this.getVersion(), dDts.getVersion());
    }

	/* (non-Javadoc)
     * @see org.bmind.datasword.config.dto.DObjCommon#hashCode()
     */
	@Override
	public int hashCode() {
		
		// this style of lazy initialization is
		// suitable only if the object is immutable
		if (fHashCode == 0) {
		int result = HashCodeUtil.SEED;
			result = HashCodeUtil.hash(result, getID());
			result = HashCodeUtil.hash(result, getNextId());
			result = HashCodeUtil.hash(result, getPreviusId());
			result = HashCodeUtil.hash(result, getAreas());
			result = HashCodeUtil.hash(result, getRoles());
			result = HashCodeUtil.hash(result, getDescription());
			result = HashCodeUtil.hash(result, getFilePath());
			result = HashCodeUtil.hash(result, getName());
			result = HashCodeUtil.hash(result, getNote());
			result = HashCodeUtil.hash(result, getReferenceDate());
			result = HashCodeUtil.hash(result, getStatus());
			result = HashCodeUtil.hash(result, getUploadDate());
			result = HashCodeUtil.hash(result, getUploadUserID());
			result = HashCodeUtil.hash(result, getVersion());
			fHashCode = result;
		}
		return fHashCode;
	}
	
}
